﻿#pragma once

#include <QWidget>
#include "ui_GenerateH26XWindow.h"
#include <QCloseEvent>
#include <QString>
#include <thread>
#include "../../../common/utils/BinaryFileWriter.h"
#include "../record_screen/TonyCaptureScreen.h"
#include "../codec/YEncoder.h"


class GenerateH26XWindow : public QWidget
{
	Q_OBJECT

public:
	GenerateH26XWindow(QWidget* parent = nullptr);
	~GenerateH26XWindow();
	void Save();

protected:
	// 重写关闭事件处理函数
	void closeEvent(QCloseEvent* event) override;

public slots:
	void choiceOutputFilePathFunc();
	void startScreenFunc();
	void stopScreenFunc();
	void onVideoFormatChanged(int pos);

private:
	Ui::GenerateH26XWindow ui;
	QString outFilePath;
	bool isSaveing = true;
	std::unique_ptr<std::thread> renderThread;
	bool isClickedRecord = false;
	BinaryFileWriter* writer;
	YEncoder* encoder = nullptr;
	int codecId = 0;
};
